package com.bckj.fastboot.paid.biz.infrastructure.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bckj.fastboot.core.sql.querybean.QueryBeans;
import com.bckj.fastboot.paid.api.entity.PayConfig;
import com.bckj.fastboot.paid.api.model.PayConfigQuery;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.jdbc.SQL;

import java.util.List;

@Mapper
public interface PayConfigMapper extends BaseMapper<PayConfig> {

    @SelectProvider(type = PayConfigProvider.class, method = "queryByCondition")
    List<PayConfig> queryByCondition(PayConfigQuery query);

    class PayConfigProvider {
        public String queryByCondition(PayConfigQuery query) {
            SQL sql = new SQL();
            sql.SELECT("*");
            sql.FROM("pay_config pc");
            QueryBeans.buildQueryCondition(sql, query);
            return sql.toString();
        }
    }
}
